<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>简易计算器</title>
</head>

<body>
    <pre>
     思路：
     1.用v-model 获取表单元素中A和B的数值
     2.点击按钮将数据叠加  此处的



    </pre>
    <div class="app">
        <h1>简易计算器</h1>
        <div>
            <span>计算数值A：</span>
            <input type="text" v-model="a">
        </div>
        <div>
            <span>计算数值B：</span>
            <input type="text" v-model="b">
        </div>
        <div>
            <button v-on:click="calulate">点击计算</button>
        </div>
        <div>
            <span>计算结果</span>
            <span v-text="result"></span>
        </div>
    </div>
</body>
<script type="text/javascript" src="./js/vue.js"></script>
<script type="text/javascript">
    var xm = new Vue({
        el: '.app',
        data: {
            a: '',
            b: '',
            result: ''
        },
        methods: {
            calulate() {
          this.result = parseInt(this.a) + parseInt(this.b)
            }
        }
    })
</script>

</html>